cmake_minimum_required(VERSION 3.5)

project(nice2d)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb -pg -fsanitize=address")
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)

INCLUDE_DIRECTORIES(thirdparty/sfmlhelper)

file(GLOB SFMLHELPER_SRC thirdparty/sfmlhelper/*.h thirdparty/sfmlhelper/*.cpp)
add_library(sfmlhelper STATIC ${SFMLHELPER_SRC})

INCLUDE_DIRECTORIES(source/include)
INCLUDE_DIRECTORIES(source/source)
INCLUDE_DIRECTORIES(./)

file(GLOB NICE2D_SRC
    source/include/nice2d/*.h
    source/include/nice2d/components/*.h
    source/include/nice2d/actions/*.h
    source/include/nice2d/widgets/*.h
    source/include/nice2d/piece/*.h
    source/source/nice2d/*.cpp source/source/nice2d/*.h
    source/source/nice2d/components/*.cpp source/source/nice2d/components/*.h
    source/source/nice2d/actions/*.cpp source/source/nice2d/actions/*.h
    source/source/nice2d/charts/*.cpp source/source/nice2d/charts/*.h
    source/source/nice2d/widgets/*.cpp source/source/nice2d/widgets/*.h
    source/source/nice2d/piece/*.cpp source/source/nice2d/piece/*.h
)

add_library(nice2d STATIC ${NICE2D_SRC})
target_link_libraries(nice2d stdc++fs sfmlhelper sfml-system sfml-graphics sfml-window sfml-audio)

add_subdirectory(application)
